<?php

namespace App\Http\Controllers\Api\V1;

use App\Models\Users;
use Illuminate\Http\Request;

class TestsController extends BaseController
{
    /**
     * index 获取所有用户信息
     * 
     * @return mixed
     */
    public function index()
    {
        $tests = Users::all();
        // dd($tests);
        return $this->collection($tests, new TransformerController());
    }

    /**
     * show 获取某个用户数据
     * @param $id
     */
    public function show($id)
    {
        $test = User::find($id);
        if (!$test) {
            return $this->response->errorNotFound('Test not found');
        }
        return $this->collection($test, new TransformerController());
//        return $this->item($test, new TestsTransformer());
    }
}
